<?php

//  ------------------------------------------------------------------------ //
//                XOOPS - PHP Content Management System                      //
//                    Copyright (c) 2000 xoops.org                           //
//                       <http://www.xoops.org/>                             //
//  ------------------------------------------------------------------------ //
//  This program is free software; you can redistribute it and/or modify     //
//  it under the terms of the GNU General Public License as published by     //
//  the Free Software Foundation; either version 2 of the License, or        //
//  (at your option) any later version.                                      //
//                                                                           //
//  You may not change or alter any portion of this comment or credits       //
//  of supporting developers from this source code or any supporting         //
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
// Author: Dirk Herrmann (Alfred)                                            //
// Site: http://www.simple-xoops.de                                          //
// Project: The XOOPS Project                                                //
// ------------------------------------------------------------------------- //

if( ! defined( 'XOOPS_ROOT_PATH' ) ) die("XOOPS_ROOT_PATH not defined!");
$module_name = basename( dirname( __FILE__ )) ;

$modversion['name']		  		  	= _MI_INFO_NAME;
$modversion['version']			  	= 2.1;  
$modversion['simpleversion']      	= '2.1.3';
$modversion['simplename'] 		  	= "info";
$modversion['simpleid']			  	= 7;
$modversion['author']     			= 'Dirk Herrmann';
$modversion['description']			= _MI_INFO_DESC;
$modversion['credits']				= "The SIMPLE-XOOPS Project";
$modversion['license']				= "GPL see LICENSE";
$modversion['help']		    		= "";
$modversion['official']				= 0;
$modversion['image']		  		= "images/logo.gif";
$modversion['dirname']				= $module_name;
													
$modversion['onInstall']			= "sql/update.php";
$modversion['onUpdate']				= "sql/update.php";

// Tables created by sql file (without prefix!)
$modversion['tables'][0]			= $module_name;
$modversion['tables'][1]			= $module_name."_cat";
$modversion['tables'][2]			= $module_name."_bak";

// Admin things
$modversion['hasAdmin']				= 1;
$modversion['adminindex']			= "admin/index.php";
$modversion['adminmenu']			= "admin/menu.php";

//$modversion['cube_style'] 		= true;

// Smarty
$modversion['use_smarty']			= 1;

// Search
$modversion['hasSearch'] 			= 1;
$modversion['search']['file'] = "include/search.inc.php";
$modversion['search']['func'] = $module_name."_search";

$modversion['hasMain'] 				= 1;
include_once XOOPS_ROOT_PATH."/class/xoopstree.php";
include_once dirname(__FILE__)."/seo_plugin.php";
global $xoopsModuleConfig,$xoopsModule,$xoopsDB,$xoopsUser;
$seo = (!empty($xoopsModuleConfig[$module_name.'_seourl']) && $xoopsModuleConfig[$module_name.'_seourl']>0) ? intval($xoopsModuleConfig[$module_name.'_seourl']) : 0;
$info_tree = new XoopsTree($xoopsDB->prefix($module_name), "storyid", "parent_id");
if (is_object($xoopsModule) && $xoopsModule->dirname() == $module_name && basename($_SERVER['SCRIPT_NAME']) == "index.php") {	
  //Modul ist aktiv
  eval ('$para = read_'.$xoopsModule->dirname().'_para($_GET,$seo);');
  $id = $para['id'];
  $cat = $para['cid'];
  $pid = $para['pid'];  
  $cP = $info_tree->getAllParentId($id,"blockid",array("0",$id));
} else {
  $cP = array("0");
}

$cAllList = $info_tree->getFirstChild(0,"blockid");

$cPlist=array();
foreach ($cAllList as $tc) {
  if ($tc['homepage']==1) array_push($cPlist, $tc);
}
$groups =  ($xoopsUser) ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS);
$i=0; 		
foreach ($cPlist as $tcontent) {
  $visible=0;
  $vsgroup=array();
  $vsgroup=explode (",", $tcontent['visible_group']);
  $vscount=count($vsgroup)-1;		
  while ($vscount > -1){
	if (in_array($vsgroup[$vscount], $groups)) $visible = 1;
	$vscount--;
  }
  if ($tcontent['link']==3) $visible = 0;
  if (intval($tcontent['submenu'])!=1) $visible = 0;
  if ($visible==1) {
    $modversion['sub'][$i]['name'] = $tcontent['title'];
	$mode=array("seo"=>$seo,"id"=>$tcontent['storyid'],"title"=>$tcontent['title'],"dir"=>$module_name,"cat"=>$tcontent['homepage']);
	eval ('$ctURL = seo_plugin_'.$module_name.'_make($mode);');
	$ctURL = str_replace(XOOPS_URL."/modules/".$module_name."/","",$ctURL); //FIX for MainMenu
	$modversion['sub'][$i]['url'] = $ctURL;
    $i++;
  }
}
unset($i);
$i=1;
$bl_result = $xoopsDB->query("SELECT catid,title FROM ".$xoopsDB->prefix($module_name.'_cat')."");
if ($bl_result) {
  while($bl_row =$xoopsDB->fetchArray($bl_result)) {
	$modversion['pages'][$i]['name'] = $bl_row['title'];
	if ($seo==1)
	  $modversion['pages'][$i]['url'] = "".$bl_row['catid'].":";
	elseif ($seo==2)
	  $modversion['pages'][$i]['url'] = "?".$bl_row['catid'].":";
	elseif ($seo==3)
	  $modversion['pages'][$i]['url'] = $module_name."-".$bl_row['catid'].":";
	else	
      $modversion['pages'][$i]['url'] = "index.php?id=".$bl_row['catid'].":";
    $i++;
  }
}
unset($i);


// Templates
$modversion['templates'][1]['file'] 	    = $module_name.'_index.html';
$modversion['templates'][1]['description']  = _MI_INFO_TEMPL1;


// Blocks
$modversion['blocks'][1]['file'] 			= "info_navigation.php";
$modversion['blocks'][1]['name'] 			= _MI_INFO_BLOCK1;
$modversion['blocks'][1]['description'] 	= _MI_INFO_BLOCK1_DESC;
$modversion['blocks'][1]['show_func'] 		= "info_block_nav";
$modversion['blocks'][1]['edit_func'] 		= "info_navblock_edit";
$modversion['blocks'][1]['options'] 		= $module_name."|0|0";
$modversion['blocks'][1]['template'] 		= $module_name.'_nav_block.html';

$modversion['blocks'][2]['file'] 			= "info_freiblock.php";
$modversion['blocks'][2]['name'] 			= _MI_INFO_BLOCK2;
$modversion['blocks'][2]['description'] 	= _MI_INFO_BLOCK2_DESC;
$modversion['blocks'][2]['show_func'] 		= "info_freiblock_show";
$modversion['blocks'][2]['edit_func'] 		= "info_freiblock_edit";
$modversion['blocks'][2]['options'] 		= $module_name."|0";
$modversion['blocks'][2]['template'] 		= $module_name.'_freiblock.html';


$modversion['config'][1]['name'] 			= $module_name.'_editors';
$modversion['config'][1]['title'] 			= '_MI_INFO_CONF1';
$modversion['config'][1]['description'] 	= '_MI_INFO_CONF1_DESC';
$modversion['config'][1]['formtype'] 		= 'yesno';
$modversion['config'][1]['valuetype'] 		= 'int';
$modversion['config'][1]['default'] 		= 1;

$modversion['config'][2]['name'] 			= $module_name.'_printer';
$modversion['config'][2]['title'] 			= '_MI_INFO_CONF3';
$modversion['config'][2]['description'] 	= '_MI_INFO_CONF3_DESC';
$modversion['config'][2]['formtype'] 		= 'yesno';
$modversion['config'][2]['valuetype'] 		= 'int';
$modversion['config'][2]['default'] 		= 1;

$modversion['config'][3]['name'] 			= $module_name.'_last';
$modversion['config'][3]['title'] 			= '_MI_INFO_CONF4';
$modversion['config'][3]['description'] 	= '_MI_INFO_CONF4_DESC';
$modversion['config'][3]['formtype'] 		= 'select';
$modversion['config'][3]['valuetype'] 		= 'int';
$modversion['config'][3]['options'] 		= array('_MI_INFO_LASTD1'=>1,
													'_MI_INFO_LASTD2'=>2,
													'_MI_INFO_LASTD3'=>3,
													'_MI_INFO_LASTD4'=>4);
$modversion['config'][3]['default'] 		= _MI_INFO_LASTD1;

$modversion['config'][4]['name'] 			= $module_name.'_showrblock';
$modversion['config'][4]['title'] 			= '_MI_INFO_CONF5';
$modversion['config'][4]['description'] 	= '_MI_INFO_CONF5_DESC';
$modversion['config'][4]['formtype'] 		= 'yesno';
$modversion['config'][4]['valuetype'] 		= 'int';
$modversion['config'][4]['default'] 		= 1;

$modversion['config'][5]['name'] 			= $module_name.'_shownavi';
$modversion['config'][5]['title'] 			= '_MI_INFO_CONF6';
$modversion['config'][5]['description'] 	= '_MI_INFO_CONF6_DESC';
$modversion['config'][5]['formtype'] 		= 'select';
$modversion['config'][5]['valuetype'] 		= 'int';
$modversion['config'][5]['options'] 		= array('_MI_INFO_PAGESNAV'=>1,
													'_MI_INFO_PAGESELECT'=>2,
													'_MI_INFO_PAGESIMG'=>3);
$modversion['config'][5]['default'] 		= 1;

$modversion['config'][6]['name'] 			= $module_name.'_linklist';
$modversion['config'][6]['title'] 			= '_MI_INFO_CONF7';
$modversion['config'][6]['description'] 	= '_MI_INFO_CONF7_DESC';
$modversion['config'][6]['formtype'] 		= 'yesno';
$modversion['config'][6]['valuetype'] 		= 'int';
$modversion['config'][6]['default'] 		= 0;

$modversion['config'][7]['name'] 			= $module_name.'_seourl';
$modversion['config'][7]['title'] 			= '_MI_INFO_CONF8';
$modversion['config'][7]['description'] 	= '_MI_INFO_CONF8_DESC';
$modversion['config'][7]['formtype'] 		= 'select';
$modversion['config'][7]['valuetype'] 		= 'int';
$modversion['config'][7]['default'] 		= 0;
$modversion['config'][7]['options'] 		= array('_NONE'=>0,
													'REWRITING MODUL'=>1,
													'WRAPPER'=>2);


// Comments
$modversion['hasComments'] = 1;
$modversion['comments']['itemName'] 		= 'id';
$modversion['comments']['pageName'] 		= 'index.php';
?>
